std::round, std::lround, std::llround
From Cppreference
| C++ Standard Library | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Numerics library | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Common mathematical functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Defined in header
<cmath> | ||
| int round( float arg );
| (C++0x feature) | |
| int round( double arg );
| (C++0x feature) | |
| int round( long double arg );
| (C++0x feature) | |
| long lround( float arg );
| (C++0x feature) | |
| long lround( double arg );
| (C++0x feature) | |
| long lround( long double arg );
| (C++0x feature) | |
| long long llround( float arg );
| (C++0x feature) | |
| long long llround( double arg );
| (C++0x feature) | |
| long long llround( long double arg );
| (C++0x feature) | |
Computes nearest integer to arg. Number is rounded away from zero in halfway cases
Parameters
| arg | - | floating point value |
Return value
nearest integer to arg.
See also
| nearest integer not greater than the given value (function) | ||
| nearest integer not less than the given value (function) | ||
| nearest integer not greater in magnitude than the given value (function) | ||